package com.bawei.composeui2207a.day04

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.bawei.composeui2207a.R
import com.bawei.composeui2207a.route.RouteConfig

/**
 * 作者：赵亮
 * 时间：2024/12/13 10:57
 * 功能：启动页面
 */
@Composable
fun StartPage(navController: NavController = rememberNavController()) {

    Box(modifier = Modifier.fillMaxSize()) {
        Image(
            modifier = Modifier.fillMaxSize(),
            painter = painterResource(id = R.drawable.start),
            contentDescription = null,
            contentScale = ContentScale.Crop
        )

        Text(
            text = "跳过",
            modifier = Modifier
                .align(Alignment.TopEnd)
                .padding(top = 30.dp, end = 10.dp)
                .clickable {
                    navController.navigate(RouteConfig.MAIN + "/孙悟空")
                }
        )
    }

}

@Preview
@Composable
fun StartPreview() {
    StartPage()
}

